Skip to main content

Compiling static CURL

This page covers how you can compile curl statically so you don't rely on any DLLs at runtime. You can skip this part if you have an existing libcurl_a.lib file or know how to statically link libcurl using vcpkg.

Use vcpkg

If you dont know how to use Vcpkg or have never used it you can skip this way and use the alternative way (Downloading Curl). Install curl using this command:

vcpkg install curl:x64-windows-static 8.16.0

Please make sure that in your Visual Studio project properties > vcpkg you have enabled Use Static Libraries

Downloading Curl

Download curl from GitHub (download the zip, in this case curl-8.14.1.zip) and extract it using 7-Zip or WinRAR.

Your folder structure should look like this:

curl-8.14.1
|_ ...
|_ winbuild
|_ ...

Compiling Curl

  1. Navigate into the winbuild folder.
  2. Assuming you have VS 2022 installed, open the x64 Native Tools Command Prompt for VS 2022 (type it in the search bar, x64 is important), picture here.
  3. Navigate into the winbuild folder (cd path\to\curl-8.14.1\winbuild)
  4. Execute
   nmake /d Makefile.vc mode=static MACHINE=x64 RTLIBCFG=static WINBUILD_ACKNOWLEDGE_DEPRECATED=yes
  1. After successful compilation, navigate to curl-8.14.1\builds.
  2. The libcurl-vc-x64-release-static-ipv6-sspi-schannel folder will contain the compiled libcurl_a.lib and include folder.